package com.fms.data.file;

import java.io.File;

import junit.framework.TestCase;

import com.fms.model.domain.FlowSheet;

public class XMLExistingFlowSheetTest extends TestCase
{
	public void testRegisterNewXML()
	{
		FlowSheet sheet = new FlowSheet("test");
		
		File f = new File("testData/data.xml");
		if(f.exists())
		{
			f.delete();
		}
		
		XMLExistingFlowSheet sheets = new XMLExistingFlowSheet("testData/data.xml");
		
		assertTrue(sheets.getFlowSheets().size() == 0);
		
		sheets.registerNewFlowSheet(sheet);
		

		assertTrue(sheets.getFlowSheets().get(0).getFileName().equals("test"));
		assertFalse(sheets.getWasEmailed(0));
		
		sheets = new XMLExistingFlowSheet("testData/data.xml");
		
		assertTrue(sheets.getFlowSheets().get(0).getFileName().equals("test"));
		assertFalse(sheets.getWasEmailed(0));
		
		
		
	}
	
	public void testRegisterEmailedXML()
	{
		FlowSheet sheet = new FlowSheet("test");
		
		File f = new File("testData/data.xml");
		if(f.exists())
		{
			f.delete();
		}
		
		XMLExistingFlowSheet sheets = new XMLExistingFlowSheet("testData/data.xml");

		sheets.registerNewFlowSheet(sheet);
		sheets.registerAsEmailed(sheet);
		
		

		assertTrue(sheets.getFlowSheets().get(0).getFileName().equals("test"));
		assertTrue(sheets.getWasEmailed(0));
		
		sheets = new XMLExistingFlowSheet("testData/data.xml");
		
		assertTrue(sheets.getFlowSheets().get(0).getFileName().equals("test"));
		assertTrue(sheets.getWasEmailed(0));
		
		
		
	}
}
